#include <QDebug>

#include "task.h"

Task::Task()
{
}

QString Task::getAttributeValue(Task::TASK_ATTRIBUTE attr)
{
    QString value = "";
    switch (attr)
    {
    case GUID:
        value = this->guid;
        break;
    case TITLE:
        value = this->title;
        break;
    case DUEDATE:
        value = this->dueDate;
        break;
    case CREATOR:
        value = this->creator;
        break;
    case CREATOR_ID:
        value = this->creatorId;
        break;
    case MY_STATUS:
        value = this->myStatus;
        break;
    case TASK_STATUS:
        value = this->taskStatus;
        break;
    case STATUS_STRING:
        value = this->statusString;
        break;
    case DESCRIPTION:
        value = this->description;
        break;
    case TIME_CREATED:
        value = this->timeCreated;
        break;
    case COMMENT_ON:
        value = this->commentOn;
        break;
    case OWNER_USER_NAME:
        value = this->ownerUserName;
        break;
    case OWNER_GUID:
        value = this->ownerGuid;
        break;
    case USER_ICON:
        value = this->userIcon;
        break;
    case MULTI_STEP:
        value = this->multiStep;
        break;
    case WEBURL:
        value = this->webUrl;
        break;
    case DUEDATE_CAPTION:
        value = this->dueDateCaption;
        break;
    case ASSIGNEES_CAPTION:
        value = this->assigneesCaption;
        break;
    case ACTIVE_STEP:
        value = this->activeStep;
        break;
    case HAS_FLAG:
        value = this->hasFlag;
        break;
    }

    return value;
}

QList<TaskAssignee *> *Task::getAssignees()
{
    return this->assignees;
}

void Task::setAttribute(Task::TASK_ATTRIBUTE attr, const QString attrValue)
{
    switch (attr)
    {
    case GUID:
        this->guid = attrValue;
        break;
    case TITLE:
        this->title = attrValue;
        break;
    case DUEDATE:
        this->dueDate = attrValue;
        break;
    case CREATOR:
        this->creator = attrValue;
        break;
    case CREATOR_ID:
        this->creatorId = attrValue;
        break;
    case MY_STATUS:
        this->myStatus = attrValue;
        break;
    case TASK_STATUS:
        this->taskStatus = attrValue;
        break;
    case STATUS_STRING:
        this->statusString = attrValue;
        break;
    case DESCRIPTION:
        this->description = attrValue;
        break;
    case TIME_CREATED:
        this->timeCreated = attrValue;
        break;
    case COMMENT_ON:
        this->commentOn = attrValue;
        break;
    case OWNER_USER_NAME:
        this->ownerUserName = attrValue;
        break;
    case OWNER_GUID:
        this->ownerGuid = attrValue;
        break;
    case USER_ICON:
        this->userIcon = attrValue;
        break;
    case MULTI_STEP:
        this->multiStep = attrValue;
        break;
    case WEBURL:
        this->webUrl = attrValue;
        break;
    case DUEDATE_CAPTION:
        this->dueDateCaption = attrValue;
        break;
    case ASSIGNEES_CAPTION:
        this->assigneesCaption = attrValue;
        break;
    case ACTIVE_STEP:
        this->activeStep = attrValue;
        break;
    case HAS_FLAG:
        this->hasFlag = attrValue;
        break;
    }
}

void Task::setAssignees(QList<TaskAssignee *> *list)
{
    this->assignees = list;
}

void Task::addAssignee(TaskAssignee *assignee)
{
    this->assignees->append(assignee);
}
